class Solution:
    def jump(self, nums: list) -> int:
        step = 0
        cur = 0
        last = 0
        for i in range(len(nums) - 1):
            cur = max(cur, i + nums[i])
            if last == i:
                last = cur
                step += 1
                if cur >= len(nums) - 1:
                    break

        return step
